import request from '@/utils/request'

// 文章频道
export function getChannels () {
  return request({
    url: '/mp/v1_0/channels',
    method: 'get'
  })
}
// 文章列表
export function getArticles (params) {
  return request({
    url: '/mp/v1_0/articles',
    method: 'get',
    params
  })
}

// 删除文章
export function romveArticle (target) {
  return request({
    url: '/mp/v1_0/articles/' + target,
    headers: { 'Content-Type': 'application/json' },
    method: 'DELETE'
  })
}

// 发表文章
export function publication (params, data) {
  return request({
    url: '/mp/v1_0/articles',
    method: 'post',
    params,
    data
  })
}

// 获取指定文章
export function getArticleById (target) {
  return request({
    url: '/mp/v1_0/articles/' + target
  })
}

// 修改文章
export function setArticle (target, data) {
  return request({
    url: '/mp/v1_0/articles/' + target,
    method: 'PUT',
    data
  })
}
